import Vue from 'vue'
import Vuex from 'vuex'
Vue.use(Vuex)
export default new Vuex.Store({
  state: {
    userInfo: {
      userName: "",
      workCode: "00042"
    },
    timestamp: '',
    taskList: '',
    patientList: ''
  },
  actions: {
    saveUserInfo(ctx, userInfo) {
      ctx.commit("saveUserInfo", userInfo)
    },
    saveTimestamp(ctx, data) {
      ctx.commit("saveTimestamp", data)
    },
    saveTaskList(ctx, data) {
      ctx.commit("saveTaskList", data)
    },
    savePatientList(ctx, data) {
      ctx.commit("savePatientList", data)
    }
  },
  getters: {

  },
  mutations: {
    saveUserInfo(state, userInfo) {
      state.userInfo = userInfo
    },
    saveTimestamp(state, data) {
      state.timestamp = data
    },
    saveTaskList(state, data) {
      state.taskList = data;
    },
    savePatientList(state, data) {
      state.patientList = data;
    }
  }
})
